﻿using System;
using System.Windows.Forms;
using TFlex.DOCs.Model;
using TFlex.DOCs.UI.Objects;

namespace TFlexControlSample
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			APILoader.Initialize();
			APILoader.InitializeTFlexCADAPI();

			ConnectToDOCs();

			Application.Run(new Form1());

			DisconnectFromDOCs();

			APILoader.Terminate();
		}

		private static void ConnectToDOCs()
		{
			ServerGateway.Connect();
            TFlexDOCsClientUI.Initialize();
        }

		private static void DisconnectFromDOCs()
		{
			ServerGateway.Disconnect();
		}
	}
}
